Fix VMX guest can't boot after MCE enabled.
authorKeir Fraser <keir@xensource.com>
Wed, 27 Jun 2007 19:08:21 +0000 (20:08 +0100)
committerKeir Fraser <keir@xensource.com>
Wed, 27 Jun 2007 19:08:21 +0000 (20:08 +0100)
Signed-off-by: Xin Li <xin.b.li@intel.com>
xen/arch/x86/hvm/vmx/vmx.c
xen/include/asm-x86/processor.h

index dccf27515f6d8baeb931a6f993d64e7a61d522c0..2c5d4eb35b333d8505cddbc68913d69d5ff555fc 100644 (file)
@@ -2387,14 +2387,15 @@ static int mov_to_cr(int gp, int cr, struct cpu_user_regs *regs)
     case 4: /* CR4 */
         old_cr = v->arch.hvm_vmx.cpu_shadow_cr4;
 
-        if ( value & ~mmu_cr4_features )
+        if ( value & X86_CR4_RESERVED_BITS )
         {
-            HVM_DBG_LOG(DBG_LEVEL_1, "Guest attempts to enable unsupported "
-                        "CR4 features %lx (host %lx)",
-                        value, mmu_cr4_features);
+            HVM_DBG_LOG(DBG_LEVEL_1,
+                        "Guest attempts to set reserved bit in CR4: %lx",
+                        value);
             vmx_inject_hw_exception(v, TRAP_gp_fault, 0);
             break;
         }
+
         if ( (value & X86_CR4_PAE) && !(old_cr & X86_CR4_PAE) )
         {
             if ( vmx_pgbit_test(v) )
index 6a44e505d0729c0e7975b4ee5c3e9d04eac5cc7a..2d79337f8aa9d5f5d317676d74429ab2a86eda84 100644 (file)
 #define X86_CR4_OSXMMEXCPT     0x0400  /* enable unmasked SSE exceptions */
 #define X86_CR4_VMXE           0x2000  /* enable VMX */
 
+#define X86_CR4_RESERVED_BITS   \
+    ~(X86_CR4_VME | X86_CR4_PVI | X86_CR4_TSD | \
+      X86_CR4_DE  | X86_CR4_PSE | X86_CR4_PAE | \
+      X86_CR4_MCE | X86_CR4_PGE | X86_CR4_PCE | \
+      X86_CR4_OSFXSR | X86_CR4_OSXMMEXCPT | X86_CR4_VMXE)
+
 /*
  * Trap/fault mnemonics.
  */